Added Samples for Feed Range APIs#45166
Open
andrewmathew1 wants to merge 4 commits intoAzure:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new Azure Cosmos DB Python SDK documentation and runnable samples demonstrating how to use feed range APIs for scoped operations (queries and change feed) and parallel processing patterns.
Changes:
- Added new sync and async samples covering core feed range scenarios (read/derive/compare feed ranges, feed-range-scoped queries, and change feed).
- Added new conceptual documentation page
FeedRanges.mddescribing feed ranges, when to use them, and the relevant APIs. - Updated the samples README to reference the new feed range sample.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/samples/feed_range_management.py | New sync sample demonstrating feed range APIs and patterns. |
| sdk/cosmos/azure-cosmos/samples/feed_range_management_async.py | New async sample demonstrating feed range APIs and parallel processing with asyncio.gather(). |
| sdk/cosmos/azure-cosmos/samples/README.md | Adds an entry pointing to the new feed range sample. |
| sdk/cosmos/azure-cosmos/docs/FeedRanges.md | New conceptual + API reference doc for feed ranges (sync/async). |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds comprehensive samples and documentation for the feed range APIs. Feed ranges enable sub-container-level operations such as parallel query processing, scoped change feed consumption, and workload distribution across workers.
What's included
New sample files:
Both samples demonstrate all public feed range APIs across 7 scenarios:
Reading feed ranges from a container (read_feed_ranges)
Converting a partition key to a feed range (feed_range_from_partition_key)
Checking feed range subset relationships (is_feed_range_subset)
Querying items scoped to individual feed ranges (query_items with feed_range)
Comparing feed range queries with partition key queries
Consuming change feed scoped to a feed range (query_items_change_feed with feed_range)
Parallel change feed processing by distributing feed ranges across workers
New documentation:
FeedRanges.md — Conceptual guide covering what feed ranges are, when to use them, API reference with sync/async code snippets, feed ranges vs partition keys comparison, and important considerations (opaque values, serialization, partition splits, mutual exclusivity)
Updated:
README.md — Added entry for the new feed range samples